<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<head>
    <meta charset="utf-8">
    <title>安全协议设计工具</title>
    <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" type="text/css" href="css/identify.css"/>
    <link rel="stylesheet" type="text/css" href="css/layout.css"/>
    <link rel="stylesheet" type="text/css" href="css/account.css"/>
    <link rel="stylesheet" type="text/css" href="css/style.css"/>
    <link rel="stylesheet" type="text/css" href="css/control_index.css"/>
    <link rel="stylesheet" type="text/css" href="font-awesome/css/font-awesome.min.css"/>
    <link rel="stylesheet" type="text/css" href="css/stylesheet.css"/>
    <link rel="stylesheet" type="text/css" href="css/myProtocol.css"/>
    <link rel="stylesheet" type="text/css" href="css/common.css"/>

    <script src="js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="js/haidao.offcial.general.js"></script>
    <script type="text/javascript" src="js/select.js"></script>
    <script type="text/javascript" src="js/haidao.validate.js"></script>
    <script type="text/javascript" src="js/service.js"></script>
    <script type="text/javascript" src="js/configProtocol.js"></script>

    <style type="text/css">
        select {
            width: 80%;
            border: none;
        }

        .Lmargin {
            margin-left: -5px;
        }

        #timeInput {
            width: auto;
        }
    </style>
</head>

<body>
<div class="view-topbar">
    <div class="topbar-console">
        <div class="tobar-head fl">
            <a href="#" class="topbar-home-link topbar-btn text-center fl">
                <img src="images/dwlogo.png"  class="logoimg"/>
            </a>
            <div  class="mynav" >
                <span>电力监控协议安全设计工具</span>
            </div>
        </div>
    </div>
    <div class="topbar-info">
        <ul class="fr">
            <li class="fl topbar-info-item">
                <div class="dropdown">
                    <a href="#" class="topbar-btn">
                        <span class="fl text-normal"><span class="username"></span> </span>
                        <span class="icon-arrow-down"></span>
                    </a>
                    <ul class="dropdown-menu topbar-btn-fontsize">
                        <li>
                            <a id="logout">退出</a>
                        </li>
                    </ul>
                </div>
            </li>
        </ul>
    </div>
</div>

<div class="view-body">
    <div class="view-sidebar">
        <div class="sidebar-content">
            <div class="sidebar-nav sidebar-nav-fold operator-nav">
                <div class="sidebar-title ">
                    <a href="javascript:void(0)" id="viewProtocol">
                        <span class="icon"><b class="fl icon-arrow-down"></b></span>
                        <span class="text-normal">协议预览</span>
                    </a>
                </div>
                <ul class="sidebar-trans" >
                    <li id="preview101">
                        <a href="#">
                            <b class="sidebar-icon"></b>
                            <span class="text-normal">IEC60870-5-101</span>
                        </a>
                    </li>
                    <li id="preview104">
                        <a href="#">
                            <b class="sidebar-icon"></b>
                            <span class="text-normal">IEC60870-5-104</span>
                        </a>
                    </li>
                    <li id="previewgoose">
                        <a href="#">
                            <b class="sidebar-icon"></b>
                            <span class="text-normal">IEC61850-GOOSE</span>
                        </a>
                    </li>
                    <li id="previewsv">
                        <a href="#">
                            <b class="sidebar-icon"></b>
                            <span class="text-normal">IEC61850-SV</span>
                        </a>
                    </li>
                    <li id="previewmms">
                        <a href="#">
                            <b class="sidebar-icon"></b>
                            <span class="text-normal">IEC61850-MMS</span>
                        </a>
                    </li>
                    <li id="previewdnp3">
                        <a href="previewDNP3.html">
                            <b class="sidebar-icon"></b>
                            <span class="text-normal">DNP3</span>
                        </a>
                    </li>
                </ul>
            </div>

            <div class="sidebar-nav operator-nav">
                <div class="sidebar-title">
                    <a href="#" id="designProtocol">
                        <span class="text-normal ml-5 mloader" >协议设计</span>
                    </a>
                </div>
            </div>

            <div class="sidebar-nav operator-nav">
                <div class="sidebar-title">
                    <a href="#" id="testProtocol" >
                        <span class="text-normal ml-5">协议测试</span>
                    </a>
                </div>
            </div>
        </div>
    </div>

    <div class="view-product">
        <div class="content-header">
            <ol class="breadcrumb">
                <li>
                    <a href="index.html" title="主页"><i class="fa fa-home"> 主页</i> </a>
                </li>
                <li>新建配置</li>
            </ol>
        </div>
        <div class="message-manage">
            <div class="margin-tb manage-detail-con clearfix" style="margin: 10px 50px -30px 20px;">

                <div class="manage-record margin-lr" style="margin-top:-10px; ">
                    <div id="myDiv" style="float: left;margin-bottom: 5px;margin-left: -20px;margin-top: 5px">
                        <h4><i class="fa fa-chevron-circle-right fa-1x"></i> 安全协议配置</h4>
                    </div>
                    <div style="float: right;margin-bottom: 5px;">
                        <button style="display: inline-block;margin-right: 15px;border: 1px solid rgba(0,0,0,0.5);padding: 5px;border-radius: 5px" id="saveConfig" onclick="saveConfigInfo()">
                                <i class="fa fa-save fa-lg"></i> 点击保存
                        </button>
                    </div>
                </div>

                <div class="offcial-table margin-top clearfix clear" id="myContent">
                    <div class='offcial-table tr-border margin-big-top clearfix' id='configuration_protocol'>

                        <!--认证协商-->
                        <div class='dProtocol' id="identityConfig" style="display: none;">
                            <p style='display: inline-block;'>认证方式配置</p>
                            <div >
                                <div class='mLField'>
                                    <i class='fa fa-cog fa-lg'></i>
                                    <select id="identityMethod">
                                        <option value='null' disabled="disabled">请选择认证方式</option>
                                        <option value='0-RTT'>0-RTT ECDH</option>
                                        <option value='1-RTT' selected>1-RTT PSK</option>
                                    </select>
                                </div>

                            </div>
                        </div>


                        <!--加密协商-->
                        <div class='dProtocol' id="encryptionConfig" style="display: none;">
                            <p style='display: inline-block;'>加密协商配置</p>
                            <div >
                                <div class='mLField' title='用于标识客户端加密方法,0代表3DES算法，1代表AES算法'>
                                    <i class='fa fa-cog fa-lg'></i>
                                    <select id="encryptAlgorithm">
                                        <option value='null' disabled="disabled">请选择加密算法</option>
                                        <option value='3DES'>3DES算法</option>
                                        <option value='AES'>AES算法</option>
                                        <option value='extend'>自定义算法</option>
                                    </select>
                                </div>
                                <div  class='mLField Lmargin' title='用于标识客户端加密模式,0代表ECB加密模式，1代表OFB模式'>
                                    <i class='fa fa-cog fa-lg'></i>
                                    <select id="encryptMode">
                                        <option value='null' disabled="disabled">请选择加密模式</option>
                                        <option value='ECB'>ECB</option>
                                        <option value='OFB'>OFB</option>
                                    </select>
                                </div>
                                <div class='mLField Lmargin' title='用于标识客户端加密结果输出类型,0代表输出类型为Base64，1代表输出类型为Hex'>
                                    <i class='fa fa-cog fa-lg'></i>
                                    <select id="encryptOutput">
                                        <option value='null' disabled="disabled">请选择加密输出类型</option>
                                        <option value='BASE64'>BASE64</option>
                                        <option value='HEX'>HEX</option>
                                    </select>
                                </div>
                                <div  class='mLField Lmargin' title='0表示加密协议报文的数据部分;1代表加密整个协议报文'>
                                    <i class='fa fa-cog fa-lg'></i>
                                    <select id="encryptRange">
                                        <option value='null' disabled="disabled">请选择数加密范围</option>
                                        <option value='0'>加密协议数据部分</option>
                                        <option value='1'>加密整个协议报文</option>
                                    </select>
                                </div>
                            </div>
                        </div>

                        <!--异常检测-->
                        <div class='dProtocol' id="exceptionConfig" style="display: none;">
                            <p style='display: inline-block;'>异常检测配置</p>
                            <div >
                                <div  class='mLField Lmargin' title='选择异常检测的方法'>
                                    <i class='fa fa-cog fa-lg'></i>
                                    <select id="exceptionMethod">
                                        <option value='null' disabled="disabled">选择异常检测的方法</option>
                                        <option value='0'>数据包头溢出</option>
                                        <option value='1'>字段类型合法性</option>
                                    </select>
                                </div>

                            </div>

                        </div>

                        <!--防病毒配置-->
                        <div class='dProtocol' id="defendConfig" style="display: none;">
                            <p style='display: inline-block;'>防病毒配置</p>
                            <div >
                                <div class='mLField Lmargin' title='选择防病毒的方法'>
                                    <i class='fa fa-cog fa-lg'></i>
                                    <select id="virusMethod">
                                        <option value='null' disabled="disabled">选择防病毒的方法</option>
                                        <option value='0'>文件扫描</option>
                                        <option value='1'>特征码检测</option>
                                    </select>
                                </div>
                            </div>

                        </div>

                        <!--通信重传-->
                        <div class='dProtocol' id="resendConfig" style="display: none;">
                            <p style='display: inline-block;'>通信重传配置 </p>
                            <div >
                                <div  class='mLField Lmargin' title='选择重传队列大小'>
                                    <i class='fa fa-cog fa-lg'></i>
                                    <select id="resendQueue">
                                        <option value='null' disabled="disabled">选择重传队列大小</option>
                                        <option value='1'>1</option>
                                        <option value='2'>2</option>
                                        <option value='3' selected>3</option>
                                        <option value='4'>4</option>
                                        <option value='5'>5</option>
                                        <option value='6'>6</option>
                                        <option value='7'>7</option>
                                        <option value='8'>8</option>
                                        <option value='9'>9</option>
                                    </select>
                                </div>
                                <div  class='mLField Lmargin' title='配置重传超时时间'>
                                    <i class='fa fa-cog fa-lg'></i>
                                    重传超时时间(ms): <input type="text" name="" maxlength="6" id="timeInput" value="10.000" placeholder="超时时间"/>
                                </div>
                                <div  class='mLField Lmargin' title='选择重传次数上限'>
                                    <i class='fa fa-cog fa-lg'></i>
                                    <select id="resendCount">
                                        <option value='null' disabled="disabled">选择重传次数上限</option>
                                        <option value='1'>1</option>
                                        <option value='2'>2</option>
                                        <option value='3'>3</option>
                                        <option value='4'>4</option>
                                        <option value='5'>5</option>
                                        <option value='6'>6</option>
                                        <option value='7'>7</option>
                                        <option value='8'>8</option>
                                        <option value='9'>9</option>
                                    </select>
                                </div>
                                <div>
                                    <p style="color: red;font-size: 10px;display: inline">提示:</p>
                                    <p style="font-size: 10px;display: inline">重传超时时间不能超过30ms,小数点后保留三位小数</p>
                                </div>
                            </div>

                        </div>

                        <!--完整性配置-->
                        <div class='dProtocol coIntegrity' id="integrityConfig" style="display: none;">
                            <p style='display: inline-block;'>完整性校验配置</p>
                            <div id='leftArea'>
                                <div  class='mLField Lmargin ' title='选择要使用的校验算法'>
                                    <i class='fa fa-cog fa-lg'></i>
                                    <select id="integrityAlgorithm">
                                        <option value='null' disabled="disabled">请选择校验算法</option>
                                        <option value='MD5'>MD5</option>
                                        <option value='SHA1'>SHA1</option>
                                        <option value='extend'>自定义算法</option>
                                    </select>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>

        </div>
    </div>

</div>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/dealProtocolConfig.js"></script>
<script type="text/javascript">
    $(function(){
        $.get("topbar.html",function (data) {
            $(".view-topbar").empty();
            $(".view-topbar").html(data);
        });
        $.get("siderbar.html", function(data) {
            $(".view-sidebar").empty();
            $(".view-sidebar").html(data);
            $("#designProtocol").css("background","#40BEA6");
        });
    });
    checkRole('operator');
    listDesignFunctions(paramId);
</script>
</body>

</html>